/*****************************************************************************
  Copyright ?2002-2004 by Martin Cook. All rights are reserved. If you like
  this code then feel free to go ahead and use it. The only thing I ask is 
  that you don't remove or alter my copyright notice. Your use of this 
  software is entirely at your own risk. I make no claims about the 
  reliability or fitness of this code for any particular purpose. If you 
  make changes or additions to this code then please clearly mark your code 
  as yours. If you have questions or comments then please contact me at: 
  martin@codegator.com
  
  Have Fun! :o)
*****************************************************************************/

using System;
using System.Data;

namespace CG.Security.Data
{

	/// <summary>
	/// Data access operations for users.
	/// </summary>
	public interface IUserData
	{
		
		/// <summary>
		/// Creates a new system-level user.
		/// </summary>
		/// <param name="userName">The user name (must be unique).</param>
		/// <param name="userPwd">The user password (must be hashed).</param>
		/// <returns>The identifier for the new user.</returns>
		int Create(
			string userName,
			string userPwd
			);

		// ******************************************************************

		/// <summary>
		/// Deletes a system-level user.
		/// </summary>
		/// <param name="userID">The identifier for the user.</param>
		void Delete(
			int userID
			);

		// ******************************************************************

		/// <summary>
		/// Updates the user name for the specified user.
		/// </summary>
		/// <param name="userID">The identifier for the user.</param>
		/// <param name="userName">The new user name (must be unique).</param>
		void Update(
			int userID,
			string userName
			);

		// ******************************************************************

		/// <summary>
		/// Updates the password for the specified user.
		/// </summary>
		/// <param name="userID">The identifier for the user.</param>
		/// <param name="oldUserPwd">The existing user password (must be hashed).</param>
		/// <param name="newUserPwd">The new user password (must be hashed).</param>
		int UpdatePassword(
			int userID,
			string oldUserPwd,
			string newUserPwd
			);
        
		// ******************************************************************

		/// <summary>
		/// Returns all the system-level users in the database.
		/// </summary>
		/// <returns>A DataSet containing all the users.</returns>
		System.Data.DataSet FindAll();

		// ******************************************************************

		/// <summary>
		/// Returns the properties for the specified user.
		/// </summary>
		/// <param name="userName">The name of the user.</param>
		/// <returns>A DataReader containing the properties for the specified user.</returns>
		System.Data.IDataReader FindByUserName(
			string userName
			);

		// ******************************************************************

		/// <summary>
		/// Returns the properties for the specified user.
		/// </summary>
		/// <param name="userID">The identifier for the user.</param>
		/// <returns>A DataReader containing the properties for the specified user.</returns>
		System.Data.IDataReader FindByPK(
			int userID
			);

	} // End IUserData

} // End namespace CG.Security.Data

